package com.remark.Scheduled;

import com.remark.service.ESManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@EnableScheduling
@Configuration
public class ScheduledRestart {
    @Autowired
    private ESManagerService esManagerService;

    /**
     * 每6小时定时刷新搜索库
     */
    @Scheduled(cron = "0 0 0/6 * * ?")
    public void restartES(){
        esManagerService.importAll();
    }
}
